﻿using System;

namespace NewUIConceptTest
{
    public class HeadsUpDisplay : IDrawable
    {
        private readonly ConsoleSprite _sideSprite;

        public HeadsUpDisplay()
        {
            _sideSprite = new ConsoleSprite
                              {
                                  BackgroundColor = ConsoleColor.DarkGray,
                                  ForegroundColor = ConsoleColor.Gray,
                                  Character = '█',
                                  Height = 1,
                                  Width = 1
                              };
        }
        #region IDrawable Members

        public void Draw(ICanvas canvas)
        {
            // meh. The System.Console class doesn't expose the underlying Screen Buffer,
            // so we can't draw sprites as different colors...
            for (Int32 i = 0; i < canvas.Width; i++)
            {
                canvas.DrawSpriteAt(_sideSprite, i, 0);
                canvas.DrawSpriteAt(_sideSprite, i, canvas.Height - 1);
            }

            for (Int32 i = 0; i < canvas.Height; i++)
            {
                canvas.DrawSpriteAt(_sideSprite, 0, i);
                canvas.DrawSpriteAt(_sideSprite, canvas.Width - 1, i);
            }
        }

        #endregion
    }
}
